<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        //构造函数
        function fun(name,age,sex,friend,say){
            this.name = name;
            this.age = age;
            this.sex = sex;
            this.friend = friend;
            this.say = say;
            document.write("我叫"+this.name+" 今年"+this.age+"岁 性别"+this.sex+" 有"+this.friend+"会"+this.say)
        }
        var name = new fun("小明","18","男","男朋友","说话")


        //工厂函数
        function Car(name,data,he,price,shu){
            var obj = new Object();
            obj.name = name;
            obj.data = data;
            obj.he = he;
            obj.price = price;
            obj.shu = shu;
            obj.time = function(){
                document.write("<br>"+this.name+"  出厂时间："+this.data+"   合格证："+this.he+"   建议零售价："+this.price+"    说明："+this.shu)
            }
            return obj;
        }
        var car1 = Car("奔驰","2017-07-25","152565625465","100000000","舒服")
        car1.time()
    </script>
</body>
</html>